//
//  DietPlanTableViewCell.m
//  KeepFit
//
//  Created by Fuzzie Liu on 15/10/28.
//  Copyright © 2015年 Fuzzie Liu. All rights reserved.
//

#import "DietPlanTableViewCell.h"

@implementation DietPlanTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentLabel = [[UILabel alloc] init];
        self.contentLabel.font = [UIFont boldSystemFontOfSize:19];
        [self.contentView addSubview:_contentLabel];
        
        self.timeLabel = [[UILabel alloc] init];
        self.timeLabel.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:_timeLabel];
        self.tuImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.tuImageView];
        self.contentView.layer.borderColor = [UIColor grayColor].CGColor;
        self.contentView.layer.borderWidth = 1;
        self.contentView.layer.cornerRadius = 6;
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat cellHeight = self.bounds.size.height;
    CGFloat cellWidth = self.bounds.size.width;
    self.contentView.frame = CGRectMake(10, 5, cellWidth - 20, cellHeight - 10);
    
    CGFloat height = self.contentView.bounds.size.height;
    CGFloat width = self.contentView.bounds.size.width;
    self.contentLabel.frame = CGRectMake(20, 5, width - 40, (height - 10)/ 3 * 2);
    self.timeLabel.frame = CGRectMake(20, (height - 10)/ 3 * 2 + 5, width - 40, (height - 10)/ 3);
    
    self.tuImageView.frame = CGRectMake(self.contentView.frame.size.width - 20, self.contentView.frame.size.height / 2-5, 10, 10);
    self.tuImageView.layer.cornerRadius = 5;
    self.tuImageView.layer.masksToBounds = YES;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
